package cn.com.xcj.hibernate.ManyToMany;

import java.io.Serializable;
import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;

@Entity
public class Employer implements Serializable {
	
	private static final long serialVersionUID = 8368638382018786308L;
	private int id;
	private String name;
	private List<Employee> eeList;
	
	@Id
	public int getId() {
		return id;
	}
	public void setId(int id) {
		this.id = id;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	@ManyToMany(cascade={CascadeType.PERSIST,CascadeType.MERGE},
		targetEntity=Employee.class)
	@JoinTable(name="Employer_Employee",
			joinColumns={@JoinColumn(name="employers_id")},
			inverseJoinColumns={@JoinColumn(name="employees_id")})
	public List<Employee> getEeList() {
		return eeList;
	}
	public void setEeList(List<Employee> eeList) {
		this.eeList = eeList;
	}
	
}
